﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using AnaxibiaStudios.Smug;

namespace SmugTest
{
#if DETOUR_ENABLED
  [TestClass]
  public class PropertyAccessTest
  {
    [TestMethod]
    public void BasicPropertyGetAccessTest()
    {
      var cat = Create.Proxy<Cat>();

      Prepare.Property(() => cat.Lives).Returns(9);

      Assert.AreEqual(9, cat.Lives);
    }

    [TestMethod]
    public void BasicPropertySetAccessTest()
    {
      var cat = Create.Proxy<Cat>();

      int valueGiven = 0;
      Prepare.Property<int>(snatch => cat.Lives = snatch).ReplaceWith(v => valueGiven = v);

      cat.Lives = 9;

      Assert.AreEqual(9, valueGiven);
    }
  }
#endif
}
